﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.YWDF
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.YWDF;

    public class wf_ywdf_Map : ClassMapping<wf_ywdf>
    {
        public wf_ywdf_Map()
        {
            Id(x => x.id, map =>
            {
                map.Length(40);
                map.Column(wf_ywdf.Columns.id);
            });
            Property(x => x.is_valid, map => map.Column(wf_ywdf.Columns.is_valid));
            Property(x => x.create_date, map => map.Column(wf_ywdf.Columns.create_date));

            Property(x => x.df_date0);
            Property(x => x.df_date1);

            Property(x => x.df_describe0, map => map.Length(10000));
            Property(x => x.df_describe1, map => map.Length(10000));

            Property(x => x.df_fylx);
            Property(x => x.df_isEnd);

            //所属项目
            ManyToOne(x => x.project, map =>
            {
                map.Column(wf_ywdf.Columns.df_project_id);
                map.NotNullable(false);
            });

            //所属部门
            ManyToOne(x => x.department, map =>
            {
                map.Column(wf_ywdf.Columns.department_id);
                map.NotNullable(false);
            });

            //申请人
            ManyToOne(x => x.user0, map =>
            {
                map.Column(wf_ywdf.Columns.user0_id);
                map.NotNullable(false);
            });

            //确认人
            ManyToOne(x => x.user1, map =>
            {
                map.Column(wf_ywdf.Columns.user0_id);
                map.NotNullable(false);
            });

            Table(wf_ywdf.TableName);

            //不进行创建
            SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
